int nbh=5;
real[int] errL2(nbh);
real[int] errH1(nbh);
real[int] lesh(nbh);
ofstream pfile("resultTest.txt");


for (int i=1;i<=nbh;i++) {

mesh Carre = square(20*i,15*i,[x,y-0.5]);
fespace Vh(Carre,P1);

func g =sin(pi*x)*cos(pi*y);func sol = g;

Vh u,v;
real e ,b1,b2,r ;
e=1e-10;b1=100; b2=100; r=1 ;

solve Probleme(u,v)=
	int2d(Carre)(e*(dx(u)*dx(v)+dy(u)*dy(v)))
	+int2d(Carre)(b1*dx(u)*v+b2*dy(u)*v)
	+int2d(Carre)(r*u*v)
	-int2d(Carre) ( v*(2*pi^2*e*g+b1*pi*cos(pi*x)*cos(pi*y)-b2*pi*sin(pi*x)*sin(pi*y)+ r*g) ) 
	+on(1,2,3,4,u=g);
	
	Vh erreur = sol - u;
	errL2[i-1]=sqrt(int2d(Carre) (erreur^2));
	errH1[i-1]=sqrt(int2d(Carre) ((erreur^2)+(dx(erreur))^2+(dy(erreur))^2));

	Vh h=hTriangle;
	lesh[i-1] = h[].max;	
	pfile << lesh[i-1] <<" "<< errH1[i-1]<<" "<< errL2[i-1] << endl;

  plot(u,value=true,fill=1,nbiso=100,wait=true);

}





